package com.abel;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author xiachao
 * @date 2019-04-22
 */

public class Main {
    public static void main(String[] args) throws IOException {
        String path = "/Users/heaven/Downloads/2019_04_22_19_07_43.csv";
        String savePath = "/Users/heaven/Downloads/import.csv";
        String head = "insert into t_tag(id,tag_name,parent_tag_id,count,creator,create_reason,status,create_time,update_time) values(";
        BufferedReader br = new BufferedReader(new FileReader(path));
        FileWriter fw = new FileWriter(savePath, true);
        for(String line=br.readLine();line!=null;line=br.readLine()){
            String [] arr = line.split(",");
            String body = arr[0] + ",'" + arr[1] + "',"+arr[2]+ ","+arr[3]+",'"+arr[4]+"','"+arr[5]+"',"+arr[6]+",'"+arr[7]+"','"+arr[8]+"');\n";
            fw.write(head + body);
        }
        br.close();
        fw.close();
    }
}
